/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ourgame.tankgame.control.ai;

import com.jme3.math.FastMath;
import com.jme3.math.Vector2f;
import java.util.List;

/**
 *
 * @author echoff
 */
public class MoveAI extends AI {

    private short doType;
    private List usedDirection;

    @Override
    public void aiCheck() {
//        TODO:判断当前方向是否有障碍物
        if (isUnblocked()) {
            doType = 1;//前进
        } else {
            doType = 2;//调整方向
        }
    }

    @Override
    public void aiDo() {
//        TODO:调整方向或者是移动
        if (doType == 1) {
            move();
        } else if (doType == 2) {
            rote();
        }
    }

    private Vector2f getFatherLoc() {
//        TODO:返回老爷的位置
        return null;
    }

    private boolean isUnblocked() {
//        TODO;返回前方是否有障碍物
        return false;
    }

    private void rote() {
        //    TODO;调整方向
        while (true) {
            int directionSize = FastMath.nextRandomInt(0, 3);
            if (!usedDirection.contains(directionSize)) {
                usedDirection.add(directionSize);
                break;
            }
        }
    }

    private void move() {
//    TODO:移动
        usedDirection.clear();
    }
}
